package com.kadron.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.kadron.base.KBase;

@Entity
@Table(name = "k_user_history")
public class UserHistory extends KBase implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -262080988176582888L;

	private User user;
	private String action;
	private String type;
	private String text;
	
	private UserHistory() {
		super();
	}
	
	public UserHistory(User user, String action, String type, String text) {
		this();
		this.user = user;
		this.action = action;
		this.type = type;
		this.text = text;
	}

	@ManyToOne(targetEntity = User.class)
	@JoinColumn(name = "user_id", updatable=false)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "action")
	public String getDiscount() {
		return action;
	}

	public void setDiscount(String action) {
		this.action = action;
	}

	@Column(name = "type")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "text")
	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserHistory other = (UserHistory) obj;
		if (id != other.id)
			return false;
		return true;
	}

}
